package com.fwtai.api.controller;

import com.fwtai.config.ConfigFile;
import com.fwtai.service.api.ApiUserBankService;
import com.fwtai.tool.ToolClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 用户提现信息控制层|路由层[api]
 * @作者 田应平
 * @版本 v1.0
 * @QQ号码 444141300
 * @创建日期 2023-04-14 17:20:03
 * @官网 <url>http://www.fwtai.com</url>
*/
@RestController
@Api(tags = "用户提现信息",description = "token选填")
@RequestMapping(ConfigFile.guest_v10 +"userBank")
public class UserBankController{

  private final ApiUserBankService apiUserBankService;

  public UserBankController(final ApiUserBankService apiUserBankService){
    this.apiUserBankService = apiUserBankService;
  }

  /**添加*/
  @ApiOperation(value = "添加用户提现信息", notes = "新建|新增|添加操作,bean实体form表单方式非json格式提交")
  @ApiImplicitParams({
    @ApiImplicitParam(name = "real_name", value = "真实姓名,限制长度64个", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "id_card", value = "身份证号码,限制长度20个", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "bank_name", value = "开户银行名称（开户行）,限制长度64个", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "bank_code", value = "银行卡号,限制长度40个", dataType = "String", paramType = "query", required = true),
  })
  @PostMapping("/add")
  public void add(final HttpServletRequest request,final HttpServletResponse response){
    ToolClient.responseJson(apiUserBankService.add(request),response);
  }

  /**编辑*/
  @ApiOperation(value = "编辑用户提现信息", notes = "通过主键user_id编辑|修改数据,字段的参照表结构，主键的字段可能不是id或user_id,请参考表结构")
  @ApiImplicitParams({
    @ApiImplicitParam(name = "real_name", value = "真实姓名,限制长度64个", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "id_card", value = "身份证号码,限制长度20个", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "bank_name", value = "开户银行名称（开户行）,限制长度64个", dataType = "String", paramType = "query", required = true),
    @ApiImplicitParam(name = "bank_code", value = "银行卡号,限制长度40个", dataType = "String", paramType = "query", required = true),
  })
  @PostMapping("/edit")
  public void edit(final HttpServletRequest request,final HttpServletResponse response){
    ToolClient.responseJson(apiUserBankService.edit(request),response);
  }

  /**根据主键user_id查询对应的数据*/
  @ApiOperation(value = "获取单条的用户提现信息详细信息", notes = "通过主键user_id获取用户提现信息详细信息")
  @GetMapping("/queryById")
  public void queryById(final HttpServletResponse response){
    ToolClient.responseJson(apiUserBankService.queryById(),response);
  }

}